#!/bin/bash

# Copyright © Los Alamos National Security, LLC, and others.

. ./environment.sh

export QUACARGS="$QUACARGS --verbose"

set +e
cd wp-access

# List dataset content
y "tssearch -l ts 2>&1 | (head; echo '[...]'; tail)"
y "tssearch -lt ts 2>&1 | (head; echo '[...]'; tail)"

# Some searches
x tssearch ts en+Hurricane_Sandy en+Sandy_Abbas en+Sandy_Koufax NOTFOUND
x tssearch -iD ts en+Hurricane_Sandy en+Sandy_Abbas en+Sandy_Koufax NOTFOUND
x tssearch -iW ts en+Hurricane_Sandy en+Sandy_Abbas en+Sandy_Koufax NOTFOUND
x tssearch -riW ts en+Hurricane_Sandy en+Sandy_Abbas en+Sandy_Koufax NOTFOUND
x tssearch -triW ts en+Hurricane_Sandy en+Sandy_Abbas en+Sandy_Koufax NOTFOUND

# Verify normalization (these queries should return identical results)
x tssearch -riM ts en+Sandy_Koufax
x tssearch -riM ts en+Sandy%20Koufax

# Some failed searches
x tssearch ts NOTFOUND
x tssearch NOTADATASET en+Hurricane_Sandy

# Erroneous invocations
x tssearch ts
x tssearch -r ts
x tssearch -l ts foo


exit 0
